﻿@{
    ViewBag.Title = "HottestArtist";
}

<h2>Hottest Artist</h2>

@Html.Partial("Styles")
@Html.Partial("Script")









<script>
    function DeleteSong(ID)
    { 
        XMLhttpDeleteSong = new XMLHttpRequest();
        XMLhttpDeleteSong.open("POST", "/Products/DeleteSongAjax", true);
        XMLhttpDeleteSong.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        XMLhttpDeleteSong.onreadystatechange = reqReadyDeleteSong;
        sendStrDeleteSong = "songID=" + ID;
        XMLhttpDeleteSong.send(sendStrDeleteSong);
    }
    function reqReadyDeleteSong() {
        if (XMLhttpDeleteSong.readyState == 4 && XMLhttpDeleteSong.status == 200) {
            alert(XMLhttpDeleteSong.response);
                document.getElementById("refresh").click();

        } else if (XMLhttpDeleteSong.readyState == 4) {
            alert("error! code: " + XMLhttpDeleteSong.status);

        }
    }
    function DeleteAlbum(ID)
    { 
        XMLhttpDeleteAlbum = new XMLHttpRequest();
        XMLhttpDeleteAlbum.open("POST", "/Products/DeleteAlbumAjax", true);
        XMLhttpDeleteAlbum.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        XMLhttpDeleteAlbum.onreadystatechange = reqReadyDeleteAlbum;
        sendStrDeleteAlbum = "albumID=" + ID;
        XMLhttpDeleteAlbum.send(sendStrDeleteAlbum);
    }
    function reqReadyDeleteAlbum() {
        if (XMLhttpDeleteAlbum.readyState == 4 && XMLhttpDeleteAlbum.status == 200) {
            alert(XMLhttpDeleteAlbum.response);
            document.getElementById("refresh").click();

        } else if (XMLhttpDeleteAlbum.readyState == 4) {
            alert("error! code: " + XMLhttpDeleteAlbum.status);

        }
    }

</script>

<form action="/Products/HottestArtist" method="post">
    <input type="submit" id="refresh" hidden="hidden"/>
</form>